package com.goethe.translator;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class UpdateDB extends Activity {
	private final static String TAG = "UpdateDB";
	private GUIUtils guiUtils = new GUIUtils();
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_update_db);
		
		UpdaterHttpRequest translationsUpdater = new UpdaterHttpRequest();
		
		translationsUpdater.execute(this);
		
		boolean success = false;
		try {
			success = translationsUpdater.get();
			
			// We increment the database version so the database will be updated
			TranslationsOpenHelper.incrementDatabaseVersion(getApplicationContext());
		} catch (Exception e) {
			Log.e(TAG, e.getMessage(), e);
		}
		
		guiUtils.showUpdateResult(this, success);
	}
}
